home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / program / ctlib100.zip / INSTALL.LZH / CTSTACKS.INT < prev    next >
Text File  |  1996-10-12  |  4KB  |  126 lines

  1. {**************************************************************************}
  2. {*  BitSoft Development, L.L.C.                                           *}
  3. {*  Copyright (C) 1995, 1996 BitSoft Development, L.L.C.                  *}
  4. {*  All rights reserved.                                                  *}
  5. {*  Stack objects unit                                                    *}
  6. {*  Version 1.0.9                                                         *}
  7. {**************************************************************************}
  8.  
  9. unit ctStacks;
  10.  
  11. {$X+}
  12.  
  13. interface
  14.  
  15. uses Objects,
  16.      Containr, ctCollec, ctArrays, ctLists, ctTypes;
  17.  
  18. type
  19.   PStreamStack = ^TStreamStack;
  20.   TStreamStack = object(TStreamCollection)
  21.     function Bottom : Pointer; virtual;
  22.     function Pop : Pointer; virtual;
  23.     function Push (Item : Pointer) : Boolean; virtual;
  24.     function Top : Pointer; virtual;
  25.   end; { TStreamStack }
  26.  
  27. type
  28.   PEmsStack = ^TEmsStack;
  29.   TEmsStack = object(TStreamStack)
  30.     function InitStream(Size : LongInt): PStream; virtual;
  31.   end; { TEmsStack }
  32.  
  33. type
  34.   PLinkedStack = ^TLinkedStack;
  35.   TLinkedStack = object(TList)
  36.     function Bottom : PListNode; virtual;
  37.     function Pop : Pointer; virtual;
  38.     function Push (Item : Pointer) : Boolean; virtual;
  39.     function Top : PListNode; virtual;
  40.   end;  { TLinkedStack }
  41.  
  42. type
  43.   PCollectionStack = ^TCollectionStack;
  44.   TCollectionStack = object(TCollection)
  45.     function Bottom : Pointer; virtual;
  46.     function Pop : Pointer; virtual;
  47.     function Push (Item : Pointer) : Boolean; virtual;
  48.     function Top : Pointer; virtual;
  49.   end; { TCollectionStack }
  50.  
  51. type
  52.   PHugeCollectionStack = ^THugeCollectionStack;
  53.   THugeCollectionStack = object(THugeCollection)
  54.     function Bottom : Pointer; virtual;
  55.     function Pop : Pointer; virtual;
  56.     function Push (Item : Pointer) : Boolean; virtual;
  57.     function Top : Pointer; virtual;
  58.   end; { THugeCollectionStack }
  59.  
  60. type
  61.   PArrayStack = ^TArrayStack;
  62.   TArrayStack = object(TResizableStdArray)
  63.     function Bottom : Pointer; virtual;
  64.     function Pop : Pointer; virtual;
  65.     function Push (Item : Pointer) : Boolean; virtual;
  66.     function Top : Pointer; virtual;
  67.   end; { TArrayStack }
  68.  
  69. type
  70.   PHugeArrayStack = ^THugeArrayStack;
  71.   THugeArrayStack = object(TResizableHugeArray)
  72.     function Bottom : Pointer; virtual;
  73.     function Pop : Pointer; virtual;
  74.     function Push (Item : Pointer) : Boolean; virtual;
  75.     function Top : Pointer; virtual;
  76.   end; { THugeArrayStack }
  77.  
  78.  
  79. procedure RegisterStacks;
  80.  
  81. const
  82.   RCollectionStack : TStreamRec = (
  83.     ObjType : idCollectionStack;
  84.     VmtLink : Ofs(TypeOf(TCollectionStack)^);
  85.     Load    : @TCollectionStack.Load;
  86.     Store   : @TCollectionStack.Store);
  87.  
  88.   RHugeCollectionStack : TStreamRec = (
  89.     ObjType : idHugeCollectionStack;
  90.     VmtLink : Ofs(TypeOf(THugeCollectionStack)^);
  91.     Load    : @THugeCollectionStack.Load;
  92.     Store   : @THugeCollectionStack.Store);
  93.  
  94.   RArrayStack : TStreamRec = (
  95.     ObjType : idArrayStack;
  96.     VmtLink : Ofs(TypeOf(TArrayStack)^);
  97.     Load    : @TArrayStack.Load;
  98.     Store   : @TArrayStack.Store);
  99.  
  100.   RHugeArrayStack : TStreamRec = (
  101.     ObjType : idHugeArrayStack;
  102.     VmtLink : Ofs(TypeOf(THugeArrayStack)^);
  103.     Load    : @THugeArrayStack.Load;
  104.     Store   : @THugeArrayStack.Store);
  105.  
  106.   RLinkedStack : TStreamRec = (
  107.     ObjType : idLinkedStack;
  108.     VmtLink : Ofs(TypeOf(TLinkedStack)^);
  109.     Load    : @TLinkedStack.Load;
  110.     Store   : @TLinkedStack.Store);
  111.  
  112.   RStreamStack : TStreamRec = (
  113.     ObjType : idStreamStack;
  114.     VmtLink : Ofs(TypeOf(TStreamStack)^);
  115.     Load    : @TStreamStack.Load;
  116.     Store   : @TStreamStack.Store);
  117.  
  118.   REmsStack : TStreamRec = (
  119.     ObjType : idEmsStack;
  120.     VmtLink : Ofs(TypeOf(TEmsStack)^);
  121.     Load    : @TEmsStack.Load;
  122.     Store   : @TEmsStack.Store);
  123.  
  124. implementation
  125. end.
  126.